package gr.handmademarket.po.implementations;

import java.io.Serializable;


/**
 * the product item.
 */
public class Product 
implements Serializable{

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * the code.
	 */
	private int code = -1;
	
	/**
	 * the name.
	 */
	private String name;
	
	/**
	 * the category.
	 */
	private ProductCategory category;
	
	/**
	 * the availability.
	 */
	private Boolean availability = true;
	
	/**
	 * the description.
	 */
	private String description;
	
	/**
	 * the price.
	 */
	private Double price;
	
	/**
	 * the seller;
	 */
	private Seller seller;

	/**
	 * gets the product id.
	 * @return product id.
	 */
	public int getCode() {
		return code;
	}

	/**
	 * sets the product id.
	 * @param code
	 */
	public void setCode(int code) {
		this.code = code;
	}

	/**
	 * gets the name.
	 * @return name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * sets the name.
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * gets the category.
	 * @return the category.
	 */
	public ProductCategory getCategory() {
		return category;
	}

	/**
	 * sets the category.
	 * @param category
	 */
	public void setCategory(ProductCategory category) {
		this.category = category;
	}

	/**
	 * gets the availability
	 * @return availability
	 */
	public Boolean getAvailability() {
		return availability;
	}

	/**
	 * sets the availability
	 * @param availability
	 */
	public void setAvailability(Boolean availability) {
		this.availability = availability;
	}

	/**
	 * gets the description
	 * @return description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * sets the description
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * Gets the price.
	 *
	 * @return Returns the price
	 */
	public Double getPrice() {
		return price;
	}
	
	/**
	 * Assigns a new value to the price.
	 *
	 * @param price the price to set
	 */
	public void setPrice(Double price) {
		this.price = price;
	}

	/**
	 * returns the seller.
	 * @return the seller.
	 */
	public Seller getSeller() {
		return seller;
	}

	/**
	 * sets the seller.
	 * @param seller the seller.
	 */
	public void setSeller(Seller seller) {
		this.seller = seller;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Product)){
			return false;
		}
		Product p = (Product) obj;
		return code == p.getCode();
	}
	
}
